﻿using System;
using System.Linq;
using System.Web.Mvc;
using BabyShop.WebSite.Services;

namespace BabyShop.WebSite.Controllers
{
    public class ProductController : BaseController
    {
        private readonly ProductService _productService = new ProductService();

        public ActionResult ProductList(int takeNumber = 6)
        {
            if (takeNumber <= 0)
                takeNumber = 6;
            var productList = _productService.GetAllProduct().OrderBy(p => p.CommonColumns.LastModified).Take(takeNumber);
            return PartialView(productList);
        }

        public ActionResult ProductDetail(Guid keyGuid)
        {
            var product = _productService.GetProduct(keyGuid);
            return View(product);
        }
    }
}
